package com.labi.designpattern.service;

import com.labi.designpattern.event.OrderEvent;
import com.labi.designpattern.service.OrderSerice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

@Service
public class OrderSericeImpl implements OrderSerice {
    @Autowired
    private ApplicationContext applicationContext;

    @Override
    public void createOrder() {
        //TODO 创建订单  省略代码1000行
        System.out.println("订单创建完成...");

        //发布订单创建完成事件
        OrderEvent orderEvent = new OrderEvent(this,"订单创建成功");
        applicationContext.publishEvent(orderEvent);
        System.out.println("..................createOrder service..over........................");

    }
}
